using QFramework;

namespace QGameFramework.Systems
{
    /// <summary>
    /// 音频系统
    /// </summary>
    public interface IAudioSystem : ISystem
    {
        #region 音量控制

        /// <summary>
        /// 设置音乐大小
        /// </summary>
        /// <param name="value"></param>
        void SetMusicVolume(float value);

        /// <summary>
        /// 设置音效大小
        /// </summary>
        /// <param name="value"></param>
        void SetSoundVolume(float value);

        /// <summary>
        /// 设置人声大小
        /// </summary>
        /// <param name="value"></param>
        void SetVoiceVolume(float value);

        #endregion

        #region 是否开启

        /// <summary>
        /// 是否打开音乐
        /// </summary>
        /// <param name="value"></param>
        void SetMusicOpen(bool value);

        /// <summary>
        /// 是否打开音效
        /// </summary>
        /// <param name="value"></param>
        void SetSoundOpen(bool value);

        /// <summary>
        /// 是否打开人声
        /// </summary>
        /// <param name="value"></param>
        void SetVoiceOpen(bool value);

        #endregion
    }

    /// <summary>
    /// 音频系统
    /// </summary>
    public class AudioSystem : AbstractSystem, IAudioSystem
    {
        #region 音量控制

        public void SetMusicVolume(float value)
        {
            AudioKit.Settings.MusicVolume.Value = value;
            LogKit.I("设置音乐音量大小成功,当前音乐音量大小：" + value);
        }

        public void SetSoundVolume(float value)
        {
            AudioKit.Settings.SoundVolume.Value = value;
            LogKit.I("设置音效音量大小成功,当前音效音量大小：" + value);
        }

        public void SetVoiceVolume(float value)
        {
            AudioKit.Settings.VoiceVolume.Value = value;
            LogKit.I("设置人声音量大小成功,当前人声音量大小：" + value);
        }

        #endregion

        #region 是否开启

        public void SetMusicOpen(bool value)
        {
            AudioKit.Settings.IsMusicOn.Value = value;
            LogKit.I("设置是否开启音乐成功,当前音乐是否开启：" + value);
        }

        public void SetSoundOpen(bool value)
        {
            AudioKit.Settings.IsSoundOn.Value = value;
            LogKit.I("设置是否开启音效成功,当前音效是否开启：" + value);
        }

        public void SetVoiceOpen(bool value)
        {
            AudioKit.Settings.IsVoiceOn.Value = value;
            LogKit.I("设置是否开启人声成功,当前人声是否开启：" + value);
        }

        #endregion

        protected override void OnInit()
        {
        }
    }
}